package com.smartsystem.modules.system.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.*;
import java.util.List;

/**
 * 用户信息DTO
 */
@Data
@Schema(description = "用户信息")
public class SysUserDTO {

    @Schema(description = "用户ID")
    private Long id;

    @NotBlank(message = "用户名不能为空")
    @Size(min = 2, max = 50, message = "用户名长度必须在2-50个字符之间")
    @Schema(description = "用户名", example = "admin", required = true)
    private String username;

    @Size(min = 6, max = 20, message = "密码长度必须在6-20个字符之间")
    @Schema(description = "密码（新增时必填，修改时选填）", example = "123456")
    private String password;

    @Size(max = 50, message = "真实姓名长度不能超过50个字符")
    @Schema(description = "真实姓名", example = "张三")
    private String realName;

    @Min(value = 1, message = "性别值必须为1或2")
    @Max(value = 2, message = "性别值必须为1或2")
    @Schema(description = "性别(1-男,2-女)", example = "1")
    private Integer gender;

    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    @Schema(description = "手机号", example = "13800138000")
    private String phone;

    @Email(message = "邮箱格式不正确")
    @Schema(description = "邮箱", example = "admin@example.com")
    private String email;

    @Schema(description = "头像URL")
    private String avatar;

    @Schema(description = "部门")
    private String department;

    @Schema(description = "职位")
    private String position;

    @NotNull(message = "状态不能为空")
    @Min(value = 0, message = "状态值必须为0或1")
    @Max(value = 1, message = "状态值必须为0或1")
    @Schema(description = "状态(0-禁用,1-启用)", example = "1", required = true)
    private Integer status;

    @Schema(description = "角色ID列表")
    private List<Long> roleIds;

    @Schema(description = "备注")
    private String remark;
}